/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package bean;

import java.io.Serializable;


/**
 *
 * @author luis
 */

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */


//@Entity
//@Table(name = "usuario")
//@NamedQuery(name = "Usuario.findAll", query = "select o from Usuario o order by o.cod_user")
//@SequenceGenerator(name = "seqUsuario", sequenceName = "SEQUSUARIO", allocationSize = 1)
public class Usuario implements Serializable {

//    @Id
//    @GeneratedValue(strategy = GenerationType.AUTO, generator = "seqUsuario")
    private int coduser;
//   @Column(nullable = false)
    private String login, senha;

    public Usuario() {
    }

    public Usuario(int coduser, String login, String senha) {
        this.coduser = coduser;
        this.login = login;
        this.senha = senha;
    }

    public int getCoduser() {
        return coduser;
    }

    public void setCoduser(int coduser) {
        this.coduser = coduser;
    }

    public String getLogin() {
        return login;
    }

    public void setLogin(String login) {
        this.login = login;
    }

    public String getSenha() {
        return senha;
    }

    public void setSenha(String senha) {
        this.senha = senha;
    }

    @Override
    public String toString() {
        return this.login;
    }

    @Override
    public int hashCode() {
        int hash = 7;
        hash = 41 * hash + this.coduser;
        return hash;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final Usuario other = (Usuario) obj;
        if (this.coduser != other.coduser) {
            return false;
        }
        return true;
    }

    public boolean validaSenha(String senha) {
        boolean ret = false;
        try{
            if(this.senha.equals(senha)){
                ret = true;
            }
        } catch (NullPointerException ex){
        }
        return ret;
    }
}
